﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Web.Mvc;
using System.Web.Security;

namespace Vacation.Models
{

    public class CreatUserModel
    {
        [Required]
        [Display(Name = "用户名")]
        [StringLength(6, ErrorMessage = "{0} 必须至少包含 {2} 个字符，最多{1}个字符。", MinimumLength = 2)]
        public string UserName { get; set; }

        [Required]
        [Display(Name = "姓名")]
        [StringLength(20, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 2)]
        public string RealName { get; set; }

        [Display(Name = "所在学院")]
        public string School { get; set; }

        [Required]
        [RegularExpression(@"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", ErrorMessage = "邮件格式不正确,示例 kieesoft@126.com")]
        [Display(Name = "电子邮件")]
        public string Email { get; set; }

        [Required]
        [StringLength(20, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "确认密码")]
        [Compare("Password", ErrorMessage = "密码和确认密码不匹配。")]
        public string ConfirmPassword { get; set; }

    }
    public class UserDetailModel
    {
        [Key]
        [Display(Name = "教师号")]
        public string UserName { get; set; }

        [Display(Name = "姓名")]
        public string RealName { get; set; }

        [Display(Name = "学院")]
        public string School { get; set; }

        [Display(Name = "角色")]
        public string Roles { get; set; }
    }

    public class UserListModel
    {
        [Key]
        [Display(Name = "教师号")]
        public string UserName { get; set; }

        [Display(Name = "姓名")]
        public string RealName { get; set; }

        [Display(Name = "学院")]
        public string School { get; set; }

    }

    public class ChangePasswordModel
    {

        [DataType(DataType.Password)]
        [Display(Name = "当前密码")]
        public string OldPassword { get; set; }

        [Display(Name = "用户名")]
        public string UserName { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "新密码")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "确认新密码")]
        [Compare("NewPassword", ErrorMessage = "新密码和确认密码不匹配。")]
        public string ConfirmPassword { get; set; }
    }

    public class LogOnModel
    {
        [Required]
        [Display(Name = "用户名")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Password { get; set; }

        [Display(Name = "记住我?")]
        public bool RememberMe { get; set; }
    }


    public class RegisterModel
    {
        [Required]
        [Display(Name = "用户名")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "电子邮件地址")]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "{0} 必须至少包含 {2} 个字符。", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "确认密码")]
        [Compare("Password", ErrorMessage = "密码和确认密码不匹配。")]
        public string ConfirmPassword { get; set; }
    }
}
